package com.luobd.bpm.business.process.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;


import java.time.LocalDateTime;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="CoreProcessDefinition对象", description="")
public class CoreProcessDef {

    private static final long serialVersionUID = 1L;


    @TableId
    private Long id;


    private Integer status;

    @TableField(value = "createTime",fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;

    @TableField("updateTime")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime updateTime;

    private Boolean deleted;

    @TableField("name")
    private String name;

    @ApiModelProperty(value = "备注")
    private String remark;

    @TableField("processDefinitionId")
    private String processDefinitionId;

    @TableField("processKey")
    private String processKey;

    @TableField("version")
    private Integer version;

    @TableField("category")
    private String category;

    @TableField("createUserId")
    private Long createUserId;

    @TableField("updateUserId")
    private Long updateUserId;


    @TableField("xml")
    private String xml;



    public static enum ProcessStatus{

        DRAFT(0,"草稿"),

        RELEASE(1,"发布"),

        SUSPEND(2,"挂起");

        private Integer code;

        private String desc;

        ProcessStatus(Integer code,String desc){
            this.code = code;
            this.desc = desc;
        }

        public Integer getCode(){
            return code;
        }

        public String getDesc(){
            return desc;
        }

        public static ProcessStatus getByCode(Integer code){
            return ProcessStatus.values()[code];
        }



    }


}
